import hashlib

# import redis
# from django_redis import get_redis_connection
from concurrent.futures.thread import ThreadPoolExecutor

POOL = ThreadPoolExecutor(max_workers=64)


def gen_md5_hex(content):
    hasher = hashlib.md5()
    hasher.update(content.encode())
    return hasher.hexdigest()


# redis_cli1 = redis.Redis(host='47.104.31.138', port=54321, password='1Qaz2Wsx')
# print(redis_cli1)
# redis_cli1.delete()
# redis_cli2 = get_redis_connection()
# print(redis_cli2)
# redis_cli.set('username', 'jackfrued', ex=1800)
# redis_cli.hset('stu1', 'name', '骆昊')
# redis_cli.hset('stu1', 'age', 40)
# redis_cli.hmset('stu2', {'name': '王大锤', 'age': 20})
# redis_cli.rpush('items', 10, 20, 30, 40, 50)
# redis_cli.sadd('set1', 10, 10, 10, 20, 20, 10, 30, 20)
# redis_cli.zadd('zset1', {'yuting': 500, 'luohao': 30, 'liuxinying': 1})
# print(redis_cli.get('username').decode())
# for field in redis_cli.hkeys('stu2'):
#     print(redis_cli.hget('stu2', field).decode())
# items = list(map(int, redis_cli.lrange('items', 3, -3)))
# print(items)
